package pl.edu.agh.nn.conf;

import pl.edu.agh.nn.data.producer.OutputDataProducer;
import pl.edu.agh.nn.data.provider.InputDataProvider;
import pl.edu.agh.nn.training.TrainingCaseProvider;
import pl.edu.agh.nn.utils.NetUtils;

/**
 * Network input/output configuration
 */
public class IOConfiguration implements IConfigurable {

	private InputDataProvider inputDataProvider;
	private OutputDataProducer outputDataProducer;
	private TrainingCaseProvider trainingCaseProvider;
	private NetUtils netUtils;

	public IOConfiguration() {
	}

	public IOConfiguration(InputDataProvider inputDataProvider, OutputDataProducer outputDataProducer,
			TrainingCaseProvider trainingCaseProvider) {
		super();
		this.inputDataProvider = inputDataProvider;
		this.outputDataProducer = outputDataProducer;
		this.trainingCaseProvider = trainingCaseProvider;
	}

	public InputDataProvider getInputDataProvider() {
		return inputDataProvider;
	}

	public void setInputDataProvider(InputDataProvider inputDataProvider) {
		this.inputDataProvider = inputDataProvider;
	}

	public OutputDataProducer getOutputDataProducer() {
		return outputDataProducer;
	}

	public void setOutputDataProducer(OutputDataProducer outputDataProducer) {
		this.outputDataProducer = outputDataProducer;
	}

	public TrainingCaseProvider getTrainingCaseProvider() {
		return trainingCaseProvider;
	}

	public void setTrainingCaseProvider(TrainingCaseProvider trainingCaseProvider) {
		this.trainingCaseProvider = trainingCaseProvider;
	}

	public NetUtils getNetUtils() {
		return netUtils;
	}

	public void setNetUtils(NetUtils netUtils) {
		this.netUtils = netUtils;
	}

	@Override
	public void configure() throws InvalidNetworkConfigurationException {
		if (this.inputDataProvider != null) {
			this.inputDataProvider.configure();
		}
		if (this.outputDataProducer != null) {
			this.outputDataProducer.configure();
		}
		if (this.trainingCaseProvider != null) {
			this.trainingCaseProvider.configure();
		}
		if (this.netUtils != null) {
			this.netUtils.configure();
		}
	}

}
